import request from '@/utils/request'

export function getRoutes() {
  return request({
    url: '/vue-element-admin/routes',
    method: 'get',
  })
}

export function getRoles(params) {
  return request({
    url: 'v1/permission/role',
    method: 'get',
    params
  })
}

export function addRole(data) {
  return request({
    url: 'v1/permission/role',
    method: 'post',
    data
  })
}

export function updateRole(id, data) {
  return request({
    url: `v1/permission/role/${id}`,
    method: 'put',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `v1/permission/role/${id}`,
    method: 'delete'
  })
}

// 获取角色下的成员
export function roleMembers(id){
  return request({
    url: `v2/role/user`,
    params:{
      roleId:id
    }
  })
}